TvExtender

Helper class to add Android TV extensions to notifications.

To create a notification with a TV extension:

  1. Create an NotificationCompat.Builder, setting any desired properties.
  2. Create a TvExtender.
  3. Set TV-specific properties using the set methods of TvExtender.
  4. Call extend to apply the extension to a notification.
Notification notification = new NotificationCompat.Builder(context)
        ...
        .extend(new TvExtender()
                .setChannelId("channel id"))
        .build();
NotificationManagerCompat.from(mContext).notify(0, notification);

TV extensions can be accessed on an existing notification by using the TvExtender(Notification) constructor, and then using the get methods to access values.

Note that prior to O this field has no effect.

Constructors

Link copied to clipboard
constructor()
Create a TvExtender with default options.
constructor(@NonNull notif: Notification)
Create a TvExtender from the TvExtender options of an existing Notification.

Functions

Link copied to clipboard
Apply a TV extension to a notification that is being built.
Link copied to clipboard
Returns the id of the channel this notification posts to on TV.
Link copied to clipboard
Returns the TV-specific content intent.
Link copied to clipboard
Returns the TV-specific delete intent.
Link copied to clipboard
Returns true if this notification should be shown on TV.
Link copied to clipboard
Returns true if this notification should not show messages over top of apps outside of the launcher.
Link copied to clipboard
Specifies the channel the notification should be delivered on when shown on TV.
Link copied to clipboard
Supplies a PendingIntent to be sent when the notification is selected on TV.
Link copied to clipboard
Supplies a PendingIntent to send when the notification is cleared explicitly by the user on TV.
Link copied to clipboard
Specifies whether this notification should suppress showing a message over top of apps outside of the launcher.